/*
 * AppletElement.cpp
 *
 *  Created on: 2010-6-6
 *      Author: guobc
 */

#include "AppletElement.h"
using namespace HA;

string AppletElement::mIds[] = { "APPLET", "" };
string AppletElement::mEnds[] = { "APPLET", "BODY", "HTML", "" };

AppletElement::AppletElement() :
	HA::CommonElement() {

}

ASTNodeList AppletElement::getParameters() {
	ASTNodeList params;
	ASTNode* node;
	ParamElement* param;
	ASTNodeList children = getChildren();
	int size = children.size();
	for (int i = 0; i < size; i++) {
		node = children.item(i);
		param = dynamic_cast<ParamElement*> (node);
		if (param != NULL) {
			params.append(param);
		}
	}
	return params;
}

ParamElement* AppletElement::getParameter(const string& name) {
	ASTNodeList params;
	ASTNode* node;
	ParamElement* param;
	ASTNodeList children = getChildren();
	int size = children.size();
	for (int i = 0; i < size; i++) {
		node = children.item(i);
		param = dynamic_cast<ParamElement*> (node);
		if (param != NULL) {
			if (param->getParamName() == name) {
				return param;
			}
		}
	}
	return NULL;
}
